<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue动画过度</title>
    <script src="vue.js"></script>
    <style>
        .fade-enter-active,.fade-leave-active{transition:opacity 3s}
        .fade-enter,.fade-leave-to{opacity: 0}
    </style>
</head>
<body>
<div id="app">
    <transition name="fade">
        <div v-if="show">Hello</div>
    </transition>
    <button @click="handleChange">切换</button>
</div>
<script>
    var vm = new Vue({
        el:"#app",
        data:{
            show:true
        },
        methods:{
            handleChange:function () {
                this.show = !this.show
            }
        }
    });
</script>
</body>
</html>